package com.lanchetech.dao;

import com.lanchetech.bean.request.OrderCommentPageReq;
import com.lanchetech.bean.request.PageReq;
import com.lanchetech.bean.response.OrderCommentResp;
import com.lanchetech.bean.vo.OrderCommentVO;
import com.lanchetech.bean.vo.StarStatisticsVO;
import com.lanchetech.entity.OrderComment;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

@Mapper
public interface OrderCommentMapper {
    int deleteByPrimaryKey(Long id);

    int insert(OrderComment record);

    int insertSelective(OrderComment record);

    OrderComment selectByPrimaryKey(Long id);

    int updateByPrimaryKeySelective(OrderComment record);

    int updateByPrimaryKey(OrderComment record);

    int updateBatch(List<OrderComment> list);

    int updateBatchSelective(List<OrderComment> list);

    int batchInsert(@Param("list") List<OrderComment> list);

    List<OrderComment> findAllByOrderId(@Param("orderId") Long orderId);

    OrderComment findOneByOrderSkuIdAndUserId(@Param("orderSkuId") Long orderSkuId, @Param("userId") Long userId);

    /**
     * 获取最近的两条记录
     *
     * @return
     */
    List<OrderCommentResp> findLatestTwo(Long spuId);

    List<OrderCommentResp> findShopLatestTwo(Long shopId);

    List<OrderCommentResp> findAllFrontPage(PageReq req);

    int updateImageListById(@Param("updatedImageList") String updatedImageList, @Param("id") Long id);

    Long countByShopIdAndStatus(@Param("shopId")Long shopId,@Param("status")Byte status);

    StarStatisticsVO avgByShopId(@Param("shopId") Long shopId);

    List<OrderCommentVO> findAllPage(OrderCommentPageReq req);

    int updateStatusById(@Param("updatedStatus")Byte updatedStatus,@Param("id")Long id);
}